Skip to content

SOF msi enable#27

Closed
libinyang wants to merge 2 commits into
thesofproject:topic/sof-devfrom
libinyang:topic/sof-dev
Closed

SOF msi enable#27
libinyang wants to merge 2 commits into
thesofproject:topic/sof-devfrom
libinyang:topic/sof-dev

Conversation

@libinyang

Copy link
Copy Markdown

Based on Liam's comments, remove the msi_enabled flag.
Tested on CNL, APL and BYT.
On out BYT platform, it doesn't support MSI (not pci device). It will use the legacy interrupt mode.

libinyang added 2 commits July 6, 2018 09:55
This patch tries to enable msi for sof hda audio driver.
If it fails (not supported by HW/BIOS), it will use the
legacy interrupt mode.

Signed-off-by: Libin Yang <libin.yang@intel.com>
This patch tries to enable msi for sof byt pci audio driver.
If it fails (not supported by HW/BIOS), it will use the
legacy interrupt mode.

Signed-off-by: Libin Yang <libin.yang@intel.com>

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpicks.
I am also not really hot on code that was never tested, e.g. for BYT/PCI this would require Edison/Tangier to work.

Comment thread sound/soc/sof/intel/hda.c
* register our IRQ
* let's try to enable msi firstly
* if it fails, use legacy interrupt mode
* TODO: support interrupt mode selection with kernel parameter

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does it take to add this? the kernel parameter doesn't seem very complicated, but I don't know what the multiple vectors mean in terms of functionality/schedule?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kernel parameter is not a must feature. It offers a choice to user to change the default behavior. There is no requirement so far and I didn't implement it. I think we can implement it only when we have such requirement, such as MSI is supported but doesn't work. In this case we need a quirk to let user set the default mode is legacy interrupt mode.
Multiple vectors is a feature of MSI, with this feature, device can offer multiple irq number. I checked on apl, and it only uses 1. To enable multiple msi vectors, the code will be a little complicated. I don't have platform to test multiple msi vectors, so I enable the single multiple currently.

Comment thread sound/soc/sof/intel/hda.c
sdev->ipc_irq = pci->irq;
} else {
dev_info(sdev->dev, "use msi interrupt mode\n");
sdev->hda->irq = pci_irq_vector(pci, 0);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you change this to avoid two calls, pci_irq_vector isn't a small function:

int pci_irq_vector(struct pci_dev *dev, unsigned int nr)
{
if (dev->msix_enabled) {
struct msi_desc *entry;
int i = 0;

	for_each_pci_msi_entry(entry, dev) {
		if (i == nr)
			return entry->irq;
		i++;
	}
	WARN_ON_ONCE(1);
	return -EINVAL;
}

if (dev->msi_enabled) {
	struct msi_desc *entry = first_pci_msi_entry(dev);

	if (WARN_ON_ONCE(nr >= entry->nvec_used))
		return -EINVAL;
} else {
	if (WARN_ON_ONCE(nr > 0))
		return -EINVAL;
}

return dev->irq + nr;

}
EXPORT_SYMBOL(pci_irq_vector);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense. I will do it :)

@libinyang

Copy link
Copy Markdown
Author

Yes, me too. I think we can merge the patch for byt later after test and merge the patch for hda firstly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants